import 'reflect-metadata';
import { DataSource } from 'typeorm';
import path from 'path';
import { app } from 'electron';
import { User } from './entity/user';
import {DouyinCookie} from "./entity/douyin_cookie";
import {VideoRecord} from "./entity/video_record";
import {AliasRecord} from "./entity/alias_record";
import {ExpertShare} from "./entity/expert_share";

export const AppDataSource = new DataSource({
    type: 'sqlite',
    database: path.join(app.getPath('userData'), 'app.sqlite'),
    synchronize: true, // 确保每次运行应用程序时实体都将与数据库同步
    logging: ['error','warn'], // 日志，默认在控制台中打印，数组列举错误类型枚举
    entities: [User,DouyinCookie,VideoRecord,AliasRecord,ExpertShare],           // 实体或模型表
    migrations: [],
    subscribers: [],
});
